# include <stdio.h>
# include <mysql.h>
# include "cvpn_mysql.h"

int main(void){
    MYSQL conn;
    
    printf ("mysql init...\n\n");
    cvpn_mysql_init (&conn,"localhost", "root", "123456", "test");
    printf ("\n");

    printf ("select * from test\n");
    cvpn_mysql_select (&conn, "select name,age from user");
    printf ("\n");

    printf("insert into user (name, age) values ('infl', 99)\n");
    const char * insert_sql = "insert into user (name, age) values ('infl', 99)";
    cvpn_mysql_execute (&conn, insert_sql);
    printf ("\n");

    printf("update user set age = 100 where name = 'infl'\n");
    const char * update_sql = "update user set age = 100 where name = 'infl'";
    cvpn_mysql_execute (&conn, update_sql);
    printf ("\n");
   
    printf("delete from user where name = 'infl'\n");
    const char * delete_sql = "delete from user where name = 'infl'";
    cvpn_mysql_execute (&conn, delete_sql);
    printf ("\n");


    printf ("mysql close\n");
    cvpn_mysql_close(&conn);
    return 0;
}
